/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.mylhyl.zxing.scanner.scan.init;

import ohos.media.camera.device.Camera;
import ohos.media.camera.device.FrameConfig;
import ohos.media.camera.device.FrameResult;
import ohos.media.camera.device.FrameStateCallback;

/**
 * 帧处理回调
 *
 */
public class FrameCallBack extends FrameStateCallback {


    /**
     * 开始帧捕获时，触发回调
     *
     * @param camera            摄像机对象
     * @param frameConfig       帧配置信息
     * @param frameNumber       帧编号
     * @param timestamp         帧捕获时间戳
     */
    @Override
    public void onFrameStarted(Camera camera, FrameConfig frameConfig, long frameNumber, long timestamp){

    }

    /**
     * 当帧捕获完成并且所有结果都可用时调用
     *
     * @param camera            摄像机对象
     * @param frameConfig       帧配置信息
     * @param frameResult       帧捕获结果
     */
    @Override
    public void onFrameFinished(Camera camera, FrameConfig frameConfig, FrameResult frameResult){

    }

    /**
     * 在帧捕获期间有部分结果时调用
     *
     * @param camera            摄像机对象
     * @param frameConfig       帧配置信息
     * @param frameResult       帧捕获结果
     */
    @Override
    public void onFrameProgressed(Camera camera, FrameConfig frameConfig, FrameResult frameResult){

    }

    /**
     * 在帧捕获过程中发生错误时调用
     *
     * @param camera            摄像机对象
     * @param frameConfig       帧配置信息
     * @param errorCode         错误码
     * @param frameResult       捕获结果
     */
    @Override
    public void onFrameError(Camera camera, FrameConfig frameConfig, int errorCode, FrameResult frameResult){

    }

    /**
     * 在启动触发器的帧捕获时调用
     *
     * @param camera                摄像机对象
     * @param captureTriggerId      触发器ID
     * @param firstFrameNumber      第一个帧编号
     */
    @Override
    public void onCaptureTriggerStarted(Camera camera, int captureTriggerId, long firstFrameNumber){

    }

    /**
     * 当触发的帧捕获动作完成时调用
     *
     * @param camera                摄像机对象
     * @param captureTriggerId      触发器ID
     * @param lastFrameNumber       最后一帧编号，-1表示没有捕获到任何帧
     */
    @Override
    public void onCaptureTriggerFinished(Camera camera, int captureTriggerId, long lastFrameNumber){

    }

    /**
     * 当已触发的帧捕获动作提前停止时调用
     *
     * @param camera                摄像机对象
     * @param captureTriggerId      触发器ID
     */
    @Override
    public void onCaptureTriggerInterrupted(Camera camera, int captureTriggerId){

    }

}
